function _toArray() {
    let arr = [];
    for (let key in this._properties) {
        if (this._properties.hasOwnProperty(key)) {
            arr.push(this._properties[key]);
        }
    }
    return arr;
}

function _toJson(lang) {
    let json = {};
    for (let key in this._properties) {
        if (this._properties.hasOwnProperty(key)) {
            if (lang) {
                json[key] = this._properties[key]['text_' + lang];
            } else {
                json[key] = this._properties[key].text;
            }
        }
    }
    return json;
}

function _get(id) {
    if (this._properties[id]) {
        return this._properties[id]
    } else {
        return { text: "", value: null };
    }
}

export default {
    // 订单状态
    Order_Status: {
        _properties: {
            0: { text: "待付款", value: 0, color: "#009900" },
            1: { text: "待发货", value: 1, color: "#c8c9cc" },
            2: { text: "待确认", value: 2, color: "#f53f50" },
            3: { text: "待评价", value: 3, color: "#ff976a" },
            4: { text: "已完成", value: 4, color: "#c8c9cc" },
            5: { text: "已关闭", value: 5, color: "#c8c9cc" },
        },
        ToArray: function() {
            return _toArray.call(this);
        },
        ToJSON: function(lang) {
            return _toJson.call(this, lang);
        },
        Get: function(id) {
            return _get.call(this, id);
        }
    }
}